/**
 * 
 */
package com.et114.modules.org.cells;

import org.extremecomponents.table.bean.Column;
import org.extremecomponents.table.cell.Cell;
import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.util.HtmlBuilder;
//import org.extremecomponents.table.limit.Limit;
//import org.extremecomponents.table.limit.Sort;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.et114.components.ectable.EXTableUtils;

/**
 * @author guanhw
 */
public class FuncCompModHrefCell implements Cell {
	protected  Log logger = LogFactory.getLog( this.getClass ( ) );
	public String getExportDisplay ( TableModel arg0 , Column arg1 ) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getHtmlDisplay ( TableModel model , Column arg1 ) {
		// TODO Auto-generated method stub
		HtmlBuilder html = new HtmlBuilder();
		html.td ( 0 ).xclose ( ) ;
		try {
			StringBuffer params = new StringBuffer();
			Object bean = model.getCurrentRowBean();
			String funcElementId = BeanUtils.getProperty( bean, "funcElementId" ); 
			params.append (  funcElementId  ) ; 
			String p_ = EXTableUtils.getLimitParams ( model.getTableHandler ( ).getTable ( ).getTableId ( ) , model.getContext ( ) ) ;
			params.append ( p_ ) ;
			html.a( "javascript:toMod( '" + params + "' )" );
			html.xclose ( );
			html.img ( model.getContext().getContextPath() + "/themes/styles/default/images/edit.gif" ) ; 
			html.aEnd ( );
		} catch (Exception e) {
			logger.error ( e.getMessage ( ) , e ) ;
		}
		html.tdEnd ( );
		return html.toString();	
		}

	}
	
